using System.Collections.Generic;
using FreeSql.DataAnnotations;

namespace ManaSky.DBCore.Entity
{
    /// <summary>
    /// 普通保存基类表
    /// </summary>
    public class BaseSaveEntity : VersionEntity
    {
        /// <summary>
        /// 是否新数据
        /// </summary>
        [Column(IsIgnore = true)]
        public bool IsNew { get { { return Id == 0; } } }
    }
    
    /// <summary>
    /// 单明细表保存基类表
    /// </summary>
    public class BaseSaveEntity<T> : BaseSaveEntity where T : BaseEntity
    {
        /// <summary>
        /// 明细数据集
        /// </summary>
        public IList<T> Dtls { get; set; }
    }
    
    /// <summary>
    /// 双明细表保存基类表
    /// </summary>
    public class BaseSaveEntity<T,T1> : BaseSaveEntity<T> where T : BaseEntity where T1 : BaseEntity 
    {
        /// <summary>
        /// 明细2数据集
        /// </summary>
        public IList<T1> TwoDtls { get; set; }
    }
    
    /// <summary>
    /// 三明细表保存基类表
    /// </summary>
    public class BaseSaveEntity<T,T1,T2> :  BaseSaveEntity<T,T1> where T : BaseEntity where T1 : BaseEntity where T2 : BaseEntity 
    {
        /// <summary>
        /// 明细3数据集
        /// </summary>
        public IList<T2> ThreeDtls { get; set; }
    }
}